<div class="layuimini-container layuimini-page-anim">
	<div class="layuimini-main">

		<fieldset class="table-search-fieldset">
			<legend>搜索信息</legend>
			<div style="margin: 10px 10px 10px 10px">
				<form class="layui-form layui-form-pane" action="">
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">服务商名</label>
							<div class="layui-input-inline">
								<input type="text" name="name" autocomplete="off"
									class="layui-input">
							</div>
						<div class="layui-inline" id="query-area-picker">
							<div class="layui-form-label">区域</div>
							<div class="
								layui-input-inline" style="width: 200px;">
								<select name="province" class="province-selector"
									data-value="西藏自治区" lay-filter="province-1">
									<option value="">请选择省</option>
								</select>
							</div>
							<div class="layui-input-inline" style="width: 200px;">
								<select name="city" class="city-selector" data-value="拉萨市"
									lay-filter="city-1">
									<option value="">请选择市</option>
								</select>
							</div>
							<div class="layui-input-inline" style="width: 200px;">
								<select name="county" class="county-selector" data-value="城关区"
									lay-filter="county-1">
									<option value="">请选择区</option>
								</select>
							</div>
						</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">状态</label>
							<div class="layui-input-inline">
								<select id="status" name="status" lay-filter="st"
									item_url="/item_lib/svr_status.json" item-filter="1,-1">
									<option value="">全部</option>
								</select>
							</div>
						</div>
						<div class="layui-inline">
							<button type="submit" class="layui-btn layui-btn-primary"
								lay-submit lay-filter="data-search-btn">
								<i class="layui-icon"></i>搜 索
							</button>
						</div>
					</div>
				</form>
			</div>
		</fieldset>
		<table class="layui-hide" id="currentTableId"
			lay-filter="currentTableFilter">
		</table>
	</div>
</div>
<script>
    layui.use(['form', 'table','miniPage','element','common','layarea'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table,
            miniPage = layui.miniPage;
        
         table.render({
            elem: '#currentTableId',
            url: '/isp/svr_list',
           // method:'post',
            //contentType:'application/json',
            where:{type:1},
            toolbar:  '<div class="layui-btn-container"></div>',//'default',
            defaultToolbar: [ 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[
                {field: 'id', width: 60, title: 'ID', sort: false},
                {field: 'name', minWidth: 100, title: '名称'}, 
                {field: 'addar', minWidth: 120, title: '地址', sort: false},
                {field: 'tel', width: 140, title: '电话'},
                {field: 'city',  width: 80,title: '所属市'},
                {field: 'status', width: 70, title: '状态', templet: 
                function(d){
                		return layui.common.castValueLable("/item_lib/svr_status.json" ,d.status)
      			},
      			 unresize: true},
                {field: 'createTime', width: 145, title: '创建时间'}
                //{field: 'modifyTime', width: 145, title: '更新时间',sort: true}
            ]],
            limits: [20, 30, 50, 100],
            limit: 20,
            page: true
            //skin: 'line'
        });

		layui.layarea.render({
		        elem: '#query-area-picker',
		        change: function (res) {
		            //选择结果
		            //console.log(res);
		        }
		    });
		//监听锁定操作
  		form.on('switch(svrStatus)', function(obj){
  			//if ()
    		layer.tips(this.value + ' ' + this.name + '：'+ obj.elem.checked, obj.othis);
  		});
          // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            /*var result = JSON.stringify(data.field);
            layer.alert(result, {
                title: '最终的搜索信息'
            });*/

            //执行搜索重载
            table.reload('currentTableId', {
                page: {
                    curr: 1
                },
                 where:  data.field
            	});
            return false;
        });

    //初始化所有select 
	layui.common.initSelect();
    });
</script>